package com.chris.core.socket.netty.run;

import com.chris.core.socket.netty.dto.SocketTypeEnum;
import com.chris.core.socket.netty.handler.StringClientHandler;
import com.chris.core.socket.netty.service.NettyClientService;
import com.chris.core.socket.netty.util.NettyClientUtil;
import com.chris.core.socket.netty.util.NettyRunTimeUtil;
import io.netty.channel.ChannelPipeline;

public class NettyStringClient {
    public static void main(String[] args) throws InterruptedException {

        NettyRunTimeUtil.runTimeBreakMark="\r\n";
       // NettyRunTimeUtil.runTimeBreakMark="";
        NettyClientUtil nettySocket = new NettyClientUtil("127.0.0.1",10102,180,NettyRunTimeUtil.runTimeBreakMark,false, SocketTypeEnum.StringSocket) {
            @Override
            public void AddChannelHandler(ChannelPipeline pipeline) {
                //自定义事件
                pipeline.addLast("客户端自定义接收事件",new StringClientHandler());
            }
        };
        nettySocket.Open();


        Thread.sleep(6000);
        System.out.println("发送测试内容");
        nettySocket.sendStrMsg("test消息1");
        nettySocket.sendStrMsg("!@#$upfile%^&*");
        nettySocket.sendStrMsg("test消息2");
        //!@#$upfile%^&*
        while (true)
        {

        }
    }
}
